      IWCGJQAutoComplete.JQAutoCompleteOptions.Html:= True;
      IWCGJQAutoComplete.OnGetAutoCompleteData:= AutoCompleteGetAutoCompleteData2;
      IWCGJQAutoComplete.JQAutoCompleteOptions.MinLength:= 2;

	  
procedure TIWAutoCompleteFrame.AutoCompleteGetAutoCompleteData2(Sender: TObject; const ATerm: string);
var
  JSon: ISuperObject;
  CodeField: TField;
  DescField: TField;
  ItemJSon: ISuperObject;
begin
  nxQuery.Close;
  nxQuery.SQL.Clear;
  nxQuery.SQL.Add('select * from products');
  nxQuery.SQL.Add('where ProductDescription like ''%'+ATerm+'%''');
  nxQuery.Open;

  CodeField:= nxQuery.FieldByName('ProductCode');
  DescField:= nxQuery.FieldByName('ProductDescription');

  JSon:= TSuperObject.Create(stArray);
  while not nxQuery.Eof do
  begin
    ItemJSon:= SO();
    ItemJSon.S['value']:= CodeField.AsString;
    ItemJSon.S['label']:= '<b>Code:</b> ' + CodeField.AsString + '<br/>' + '<i>' + DescField.AsString + '<i/>'; {html}

    JSon.AsArray.Add(ItemJSon);
    nxQuery.Next;
  end;

  WebApplication.Response.ContentType:= 'application/json';
  {$IFDEF IW12}
  WebApplication.Response.WriteString(JSon.AsJSon);
  {$ELSE}
  WebApplication.Response.Content:= JSon.AsJSon;
  {$ENDIF}
end;

